<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/inc/common.jsp"%>
<html>
<head>
<title>后台管理</title>

<script type="text/javascript">
	function saveDate(){
		var state = $("#state").combobox('getValue');
		var actionUrl = "${basePath}/sys/role/save.do";
		$('#ff').form('submit', {   
		     url:actionUrl,
		     onSubmit: function(){
		 		if(state == ""){
		 			$.messager.alert('消息', "请选择状态!");
		 			return false;
		 		}
		    	return $(this).form('validate');
		     },
		     success:function(msg){
		    	 if(msg == "success"){
		    		 window.location.href="${basePath}/sys/role/index.do";
		    	 }else if(msg == "repeat"){
		           	 $.messager.alert('消息', "该角色已存在,请修改后保存!");
		         }else{
		             $.messager.alert('消息', "系统异常,请联系管理员!");
		         }
		    }   
		 });
	}
</script>
</head>
<body class="easyui-layout">
	<div data-options="region:'center',title:'',footer:'#searchfooter'" >
		<div class="easyui-panel" data-options="fit:true,collapsible:true,title:'角色信息'"  style="padding:10px 10px 10px 10px;">
	    <form id="ff"  method="post">
	    	<table  style="width:100%;" cellpadding="0" cellspacing="1"  class="formtablecol1">
	    		<input type="hidden" id="id" name="id" value="${role.id}" />
	    		<tr>
	    			<td align="right" style="width: 20%">角色名:</td>
	    			<td class="value">
		    			<input class="easyui-textbox" type="text" name="name" value="${role.name}" data-options="required:true"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td align="right" style="width: 20%">关键字:</td>
	    			<td class="value">
		    			<input class="easyui-textbox" type="text" name="roleKey" value="${role.roleKey}" data-options="required:true"></input>
	    			</td>
	    		</tr>
	    		<tr>
	    			<td align="right" style="width: 20%">状态:</td>
	    			<td class="value">
	    				<input class="easyui-combobox" id="state" name="state" value="${role.state}" data-options="url:'<%=path%>/sys/dictionary/dicbykey.do?key=1001',method:'get',valueField:'dataCode',textField:'dataName',panelHeight:'auto',editable:false,required:true">
	    			</td>
	    		</tr>
	    	</table>
	    </form>
	</div>
	</div>
	<!-- 保存按钮 -->
	<div id="searchfooter" style="text-align:right;padding: 0px 10px">
		<a href="javascript:void(0)" class="easyui-linkbutton" onclick="saveDate()"  data-options="iconCls:'icon-page_save',plain:true" >保存</a>
		<span class="search-btn-separator"></span>
		<a href="javascript:history.go(-1)" class="easyui-linkbutton" data-options="iconCls:'icon-undo',plain:true">返回</a>
	</div>
</body>
</html>
